package model;

import java.sql.Date;

import state.AvailableState;
import state.AwayState;
import state.BusyState;
import state.CoachState;


public class Coach extends Person{
	
	private CoachState	state	= null;
	
	
	public Coach( String name, String adress, Date birthDay, Subscription subscription ) {
		super( name, adress, birthDay, subscription );
	}
	
	private double	salary;
	
	
	public double getSalary() {
		return salary;
	}
	
	
	public void setSalary( double salary ) {
		this.salary = salary;
	}
	
	
	public CoachState getState() {
		return state;
	}
	
	
	public boolean askCoach() {
		if( isCoachAvailable() ){
			setState( new BusyState() );
			return true;
		} else{
			return false;
		}
	}
	
	
	public void giveCoachFree() {
		setState( new AwayState() );
	}
	
	
	public boolean isCoachBusy() {
		if( state instanceof BusyState ){
			return true;
		} else{
			return false;
		}
	}
	
	
	public boolean isCoachAway() {
		if( state instanceof AwayState ){
			return true;
		} else{
			return false;
		}
	}
	
	
	public boolean isCoachAvailable() {
		if( state instanceof AvailableState ){
			return true;
		} else{
			return false;
		}
	}
	
	
	private void setState( CoachState state ) {
		this.state = state;
	}
	
}
